<!DOCTYPE html>
<HTML>
<?
//先通过dirname(__FILE__)获取到当前文件绝对路径，然后再按具体情况用..去控制找到templates文件夹下的header.php
include dirname(__FILE__)."/../templates/header.php";
?>
<HEAD>
	<TITLE>栏目树</TITLE>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" href="<? echo base_url() ?>css/zTreeStyle/zTreeStyle.css" type="text/css">
	<script type="text/javascript" src="<? echo base_url() ?>js/ztree/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="<? echo base_url() ?>js/ztree/jquery.ztree.all-3.2.js"></script>
	<SCRIPT type="text/javascript">

		var zTree ;

		var zTreeSetting = {
			async: {
				enable: true,
				url: "<? echo base_url() ?>index.php/category/treeJson",
				autoParam:["id=parent_id"]
			},
			callback:{
				onClick:changeMain
			}
		};

		$(document).ready(function(){
			zTree = $.fn.zTree.init($("#categoryTree"), zTreeSetting);
		});

		//改变右边的frame
		function changeMain(event, treeId, treeNode) {
			var url = "<? echo base_url() ?>index.php/category/toFrameRight?id=" + treeNode.id + "&name=" + treeNode.name + "&categoryType=" + treeNode.categoryType ;
			$("#mainFrame",window.parent.document).attr("src",url);
		}

	</SCRIPT>
</HEAD>
<BODY>
<div>
	<ul id="categoryTree" class="ztree"></ul>
</div>
</BODY>
</HTML>